tpl1="""
execute at @s if data block ~ ~ ~ Items[{{Slot:{id}b}}].id store result score @s advm_power_cost run data get block ~ ~ ~ Items[{{Slot:{id}b}}].Count 
execute at @s if data block ~ ~ ~ Items[{{Slot:{id}b}}].id run scoreboard players operation @s advm_power_cost *= @s advm_burn_value
execute at @s if data block ~ ~ ~ Items[{{Slot:{id}b}}].id run scoreboard players operaton @s advm_power += @s advm_power_cost 
execute at @s if data block ~ ~ ~ Items[{{Slot:{id}b}}].id run item replace block ~ ~ ~ container.{id} with air
"""

with open("gen.txt","w+") as f:
    for i in range(0,9):
        f.write(tpl1.format(id=str(i)))